package jee.boot.entity.task;

import jee.boot.common.basic.DataEntity;

import java.util.List;

/**
 * 导入导出的任务初始配置
 */
public class IexpTaskConfig {
    /**
     * 按无模板导出使用的数据模型
     */
    private IExportModel exportModel;
    /**
     * 按实体注解导出excel时候使用的实体对象类型
     */
    private Class<? extends DataEntity> exportEntityClass;
    /**
     * 按模板导出excel时候使用的模板名称
     */
    private String templateName;
    /**
     * 按模板导出excel时候使用的模板存储的物理路径
     */
    private String templatePath;
    /**
     * 导出的文件名
     */
    private String exportFileName;
    /**
     * 导出的文件拓展名
     */
    private String exportFileExtName="xlsx";
    /**
     * 导入数据时候使用的实体对象类型
     */
    private  Class<? extends DataEntity> importEntityClass;
    /**
     * 多动态sheet导出
     */
    private List<DynamicSheet> dynamicSheets;
    /**
     * 配置是否重置单元格公式(导出)
     */
    private boolean resetCellFormula=false;
    /**
     * 导出的文件名中是否加时间戳后缀
     */
    private boolean useTimeStamp=true;
    /**
     * 如果useTimeStamp=true,则此选项生效,默认值: _yyyyMMddHHmmss
     */
    private String TimeStampFormat="_yyyyMMddHHmmss";

    public IexpTaskConfig initExportByEntityConfig(Class<? extends DataEntity> exportEntityClass,String exportFileName){
        this.exportEntityClass=exportEntityClass;
        this.exportFileName=exportFileName;
        return  this;
    }
    public IexpTaskConfig initExportByModelConfig(IExportModel exportModel,String exportFileName){
        this.exportModel=exportModel;
        this.exportFileName=exportFileName;
        return  this;
    }
    public IexpTaskConfig initExportByTemplateConfig(String templateName,String exportFileName){
        this.initExportByTemplateConfig(templateName,exportFileName,null);
        return  this;
    }
    public IexpTaskConfig initExportByTemplatePathConfig(String templatePath,String exportFileName){
        this.initExportByTemplatePathConfig(templatePath,exportFileName,null);
        return  this;
    }
    public IexpTaskConfig initExportByTemplateConfig(String templateName,String exportFileName,List<DynamicSheet> dynamicSheets){
        this.templateName=templateName;
        this.exportFileName=exportFileName;
        this.dynamicSheets=dynamicSheets;
        return  this;
    }
    public IexpTaskConfig initExportByTemplatePathConfig(String templatePath,String exportFileName,List<DynamicSheet> dynamicSheets){
        this.templatePath=templatePath;
        this.exportFileName=exportFileName;
        this.dynamicSheets=dynamicSheets;
        return  this;
    }
    public IexpTaskConfig initImportByEntityConfig(Class<? extends DataEntity> importEntityClass){
        this.importEntityClass=importEntityClass;
        return  this;
    }

    public void setResetCellFormula(boolean resetCellFormula) {
        this.resetCellFormula = resetCellFormula;
    }

    public IExportModel getExportModel() {
        return exportModel;
    }

    public Class<? extends DataEntity> getExportEntityClass() {
        return exportEntityClass;
    }

    public String getTemplateName() {
        return templateName;
    }

    public String getTemplatePath() {
        return templatePath;
    }

    public String getExportFileName() {
        return exportFileName;
    }

    public Class<? extends DataEntity> getImportEntityClass() {
        return importEntityClass;
    }

    public List<DynamicSheet> getDynamicSheets() {
        return dynamicSheets;
    }

    public boolean isResetCellFormula() {
        return resetCellFormula;
    }

    public void setExportModel(IExportModel exportModel) {
        this.exportModel = exportModel;
    }

    public void setExportEntityClass(Class<? extends DataEntity> exportEntityClass) {
        this.exportEntityClass = exportEntityClass;
    }

    public void setTemplateName(String templateName) {
        this.templateName = templateName;
    }

    public void setTemplatePath(String templatePath) {
        this.templatePath = templatePath;
    }

    public void setImportEntityClass(Class<? extends DataEntity> importEntityClass) {
        this.importEntityClass = importEntityClass;
    }

    public void setDynamicSheets(List<DynamicSheet> dynamicSheets) {
        this.dynamicSheets = dynamicSheets;
    }

    public void setExportFileName(String exportFileName) {
        this.exportFileName = exportFileName;
    }

    public String getExportFileExtName() {
        return exportFileExtName;
    }

    public void setExportFileExtName(String exportFileExtName) {
        this.exportFileExtName = exportFileExtName;
    }

    public boolean isUseTimeStamp() {
        return useTimeStamp;
    }

    public void setUseTimeStamp(boolean useTimeStamp) {
        this.useTimeStamp = useTimeStamp;
    }

    public String getTimeStampFormat() {
        return TimeStampFormat;
    }

    public void setTimeStampFormat(String timeStampFormat) {
        TimeStampFormat = timeStampFormat;
    }
}
